<?php

namespace App\Http\Controllers;

use App\Models\Raider;

class RaiderController extends Controller
{
    public function get()
    {
        $context = $this->getInfo('Raider');

        return response()->json(
            [
                'recode' => 1,
                'context' => $context,
            ]
        );

    }

    public function getSectRaider()
    {
        $context = $this->getInfo('SectRaider');

        return response()->json(
            [
                'recode' => 1,
                'context' => $context,
            ]
        );

    }

    private function getInfo($key)
    {
        $info = Raider::where('key', $key)->first();
        $context = "";
        if ($info) {
            $context = $info->context;
        }
        return $context;
    }

}
